package com.example.evensystem.model.entity

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Entity
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.PrimaryKey
import androidx.room.Query
import androidx.room.Update

@Entity(tableName = "account")
data class Account(
    //工号
    @PrimaryKey
    val id : String,
    //密码
    var passwd : String
)

@Dao
interface AccountDao{
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insert(account: Account)

    @Delete
    fun delete(account: Account)

    @Query("select * from account where id=:id ")
    fun find(id: String): List<Account>

    @Query("select * from account ")
    fun findAll():List<Account>

    @Update
    fun update(account: Account)
}